﻿using BarcodeDelay;
using BarcodeDelay.utility;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace JTParcrelHelper.view
{
    public partial class FrmMode : Form
    {
        public bool isConfirm = false;
        public int curSpeed = 0;
        public string mode = "";
        public string loginUser = "";
        public FrmMode()
        {

            InitializeComponent();
        }

        private void btnConfirm_Click(object sender, EventArgs e)
        {
            StoParams.Instance.autoMode = "";
            isConfirm = true;
            string speed = tbSpeed.Text.Trim();
            try
            {
                if(!MathUtility.ImpIsNum(speed))
                {
                    MessageBox.Show("速度必须是整数");
                    return;
                }
                curSpeed = Convert.ToInt32(speed);
                StoParams.Instance.autoSelectedSpeed = curSpeed;
                if (comboBox1.SelectedItem==null)
                {
                    MessageBox.Show("模式没选择");
                    return;
                }
                mode = comboBox1.SelectedItem.ToString();
                StoParams.Instance.autoMode = comboBox1.SelectedItem.ToString();
                this.Close();
       

            }
            catch(Exception ex)
            {

            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            StoParams.Instance.autoMode = "";
            isConfirm = false;
            this.Close();
        }
    }
}
